package com.open.demo.flow

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch

class FlowDemo {
    suspend fun test() {
        val signEvnet = MutableSharedFlow<String>()
            signEvnet.collect { value ->
                println(value)
            }
    }
}

fun main() {
    val testFlow = flow<String>{
        emit("hello")
        emit("flow")
    }
    GlobalScope.launch {
        testFlow.collect{ value->
            println(value)
        }
    }
    println("fsdfdsf")
//    FlowDemo().test()

    val str = "ssss=100"
    val strsplit = str.split("=")
    println("${strsplit[0]}=${strsplit[1]}")
}